/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.demo.scheduler.service.task.processor;

import cn.hutool.core.collection.ListUtil;
import info.peigen.hotpot.common.core.util.IdUtil;
import info.peigen.hotpot.demo.scheduler.domain.Task;
import info.peigen.hotpot.demo.scheduler.domain.Trade;
import info.peigen.hotpot.demo.scheduler.service.enums.TaskStatus;
import info.peigen.hotpot.demo.scheduler.service.step.base.AbstractStepProcessor;
import info.peigen.hotpot.demo.scheduler.service.step.base.TaskProcessor;
import info.peigen.hotpot.demo.scheduler.service.task.base.AbstractTaskProcessor;
import org.noear.solon.annotation.Component;

import java.util.List;

/**
 * <b>(SendStubTaskProcessor)</b>
 *
 * @author Lihai
 * @version 1.0.0
 * @since 2023/9/9
 */
@Component
public class ChargeReadyProcessor extends AbstractTaskProcessor implements TaskProcessor {
    @Override
    public Task buildTask(Trade trade) {
        return Task.builder()
                .taskId(IdUtil.genId("8888"))
                .trade(trade)
                .name("充电前准备")
                .status(TaskStatus.Init)
                .taskProcessor(this)
                .build();
    }

    public List<AbstractStepProcessor> addSteps() {
        return ListUtil.toList(stubWakeUpProcessor, stubArmLeftProcessor, stubArmUpProcessor, stubCableOutProcessor);
    }

    @Override
    public Class triggerEvent() {
        return SendStubTaskProcessor.class;
    }
}
